﻿using UnityEngine;
using System.Collections;

public class CameraController : MonoBehaviour 
{
    public BoxCollider2D CameraBounds;

    private Vector3
        _min,
        _max;


    public void Start()
    {
        _min = CameraBounds.bounds.min;
        _max = CameraBounds.bounds.max;

        var cameraHalfWidth = _max.x / 2;
        var cameraHalfHeight = cameraHalfWidth * ((float)Screen.height / Screen.width);

        camera.orthographicSize = cameraHalfHeight;
        camera.transform.position = new Vector3(CameraBounds.center.x + cameraHalfWidth, CameraBounds.center.y + cameraHalfWidth, transform.position.z);

        
    }

}
